﻿@{
    ViewBag.Title = "Home Page";
}
@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/jquery_ui")
@model StockAnalyzerApp.ViewModels.IndexViewModel
<script>
    $(function () {
        $('#industry_table1 tr').click(function () {
            var tds = $(this).children();
            $('#i_symbol1').val(tds.get(0).innerHTML);
            $('#i_industry1').val(tds.get(1).innerHTML);
            $('#i_sector1').val(tds.get(2).innerHTML);
        });
        $('#industry_table2 tr').click(function () {
            var tds = $(this).children();
            $('#i_symbol2').val(tds.get(0).innerHTML);
            $('#i_industry2').val(tds.get(1).innerHTML);
            $('#i_sector2').val(tds.get(2).innerHTML);
        });
        $('.datepicker').datepicker({ format: 'yyyy-mm-dd' });
        $('#industry_table1').dataTable({
            "bJQueryUI": true,
            "sPaginationType": "full_numbers",

        });
        $('#industry_table2').dataTable({
            "bJQueryUI": true,
            "sPaginationType": "full_numbers",

        });
    });
</script>
@using (Html.BeginForm())
{
    <div class="jumbotron" style="margin-top: 20px;padding-bottom: 0;padding-top: 0;">
        <h1>Stock Data</h1>
        <p class="lead">Analyze Stock data and trends</p>
    </div>
    <div class="row">       
        <table style="width:1000px;">
            <tr>
                <td>
                    <h2 style="float:left;margin-right:20px;">Industry Name 1</h2>
                </td>
                <td>
                    <table>
                        <tr>
                            <td>Symbol</td>
                            <td><input type="text" id="i_symbol1" name="i_symbol1" value="@Model.i_symbol1" /></td>
                            <td>Industry</td>
                            <td><input type="text" id="i_industry1" name="i_industry1" value="@Model.i_industry1" /></td>
                            <td>Sector</td>
                            <td><input type="text" id="i_sector1" name="i_sector1" value="@Model.i_sector1" /></td>
                        </tr>
                    </table>
                </td>
            </tr>
            <tr>
                <td></td>
                <td>
                    <table id="industry_table1" style="width:100%;">
                        <thead>
                            <tr>
                                <th>Symbol</th>
                                <th>Industry</th>
                                <th>Sector</th>
                            </tr>
                        </thead>
                        <tbody>
                            @foreach (var c in Model.industryInfoList)
                            {
                                <tr>
                                    <td>@c.Symbol</td>
                                    <td>@c.Industry</td>
                                    <td>@c.Sector</td>
                                </tr>
                            }
                        </tbody>
                    </table>
                </td>
            </tr>
            <tr>
                <td>
                    <h2 style="float:left;margin-right:20px;">Industry Name 2</h2>
                </td>
                <td>
                    <table>
                        <tr>
                            <td>Symbol</td>
                            <td><input type="text" id="i_symbol2" name="i_symbol2" value="@Model.i_symbol2" /></td>
                            <td>Industry</td>
                            <td><input type="text" id="i_industry2" name="i_industry2" value="@Model.i_industry2" /></td>
                            <td>Sector</td>
                            <td><input type="text" id="i_sector2" name="i_sector2" value="@Model.i_sector2" /></td>
                        </tr>
                    </table>
                </td>
            </tr>
            <tr>
                <td></td>
                <td>
                    <table id="industry_table2" style="width:100%;">
                        <thead>
                            <tr>
                                <th>Symbol</th>
                                <th>Industry</th>
                                <th>Sector</th>
                            </tr>
                        </thead>
                        <tbody>
                            @foreach (var c in Model.industryInfoList)
                            {
                                <tr>
                                    <td>@c.Symbol</td>
                                    <td>@c.Industry</td>
                                    <td>@c.Sector</td>
                                </tr>
                            }
                        </tbody>
                    </table>
                </td>
            </tr>
            <tr>
                <td><h2 style="float:left;margin-right:20px;">Date Range Type</h2></td>
                <td>
                    @foreach (var a in Model.dateRangeTypeList)
                    {
                        <p>
                            @Html.RadioButtonFor(b => b.seletedDataRangeType, a.Value)  @a.Key
                        </p>
                    }
                </td>
            </tr>
            <tr>
                <td>
                    <h2 style="float:left;margin-right:20px;">Start Date</h2>
                </td>
                <td>
                    <input type="text" id="i_fromDate" name="i_fromDate" class="datepicker" value="@Model.i_fromDate" />
                </td>
            </tr>
            <tr>
                <td>
                    <h2 style="float:left;margin-right:20px;">End Date</h2>
                </td>
                <td>
                    <input type="text" id="i_toDate" name="i_toDate" class="datepicker" value="@Model.i_toDate"/>
                </td>
            </tr>
            <tr>
                <td></td>
                <td>
                    <input id="Submit1" type="submit" value="submit" />
                </td>
            </tr>
        </table>
    </div>
}
@Model.highcharts